package com.lzy.cloud.ticket.train.servcie.impl;

import com.lzy.cloud.ticket.train.dtos.TrainExpressInfoDto;
import com.lzy.cloud.ticket.train.entity.TrainExpressInfo;
import com.lzy.cloud.ticket.train.mapper.TrainExpressInfoMapperExt;
import com.lzy.cloud.ticket.train.servcie.TrainExpressInfoService;
import com.lzy.framework.core.utils.DozerUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by WIN7 on 2018/6/1.
 */
@Service
public class TrainExpressInfoServiceImpl implements TrainExpressInfoService {


    @Autowired
    TrainExpressInfoMapperExt  trainExpressInfoMapperExt;

    @Override
    public TrainExpressInfoDto queryTrainExpressInfoByOrederId(Long trainOrderId) {
        return trainExpressInfoMapperExt.queryTrainExpressInfoByOrederId(trainOrderId);
    }

    @Override
    public boolean updateTrainExpressInfo(TrainExpressInfoDto trainExpressInfoDto) {
        return trainExpressInfoMapperExt.updateByPrimaryKeySelective(DozerUtils.map(trainExpressInfoDto, TrainExpressInfo.class))>0;
    }

    @Override
    public boolean createTrainExpressInfo(TrainExpressInfoDto trainExpressInfoDto) {
        return trainExpressInfoMapperExt.insertSelective(DozerUtils.map(trainExpressInfoDto, TrainExpressInfo.class))>0;
    }
}
